"""
用户 PO
"""

from models import POBase
from my_typing import *
from utils.data_utils.special import ObjectIdStr
from utils.validator_utils.pydantic_validator.field import (
    CharField,
    NormalField,
)


class UserPO(POBase):
    """ 用户 | PO """

    avatar_id: ObjectIdStr = NormalField(..., title="头像 ID")
    email: StrOrNone = CharField(None, title="邮箱", max_length=64)
    nickname: str = CharField(..., title="用户名", min_length=3, max_length=20)
    password: str = CharField(..., title="密码", min_length=64, max_length=64)
    phone: StrOrNone = CharField(None, title="手机号", min_length=11, max_length=11)
    username: str = CharField(..., title="用户名", min_length=3, max_length=20)
    is_admin: bool = NormalField(False, title="是否是管理员")
